
const host = 'http://1.117.108.243:8080'

function ajax_post(url, allowAsync, formData, successCallback, errorCallback) {
    $.ajax({
        method: 'POST',
        // headers:{
        //     "site":'jp'
        // },
        url: url,
        dataType: 'JSON',
        async: allowAsync,
        data: formData,
        success: successCallback,
        error: errorCallback
    });
}

function ajax_get(url, allowAsync, formData, successCallback, errorCallback) {
    $.ajax({
        method: 'GET',
        // headers:{
        //     "site":'jp'
        // },
        url: url,
        dataType: 'JSON',
        async: allowAsync,
        data: formData,
        success: successCallback,
        error: errorCallback
    });
}

function getHtmlStr(str){
    let arrEntities = {
        'lt': '<',
        'gt': '>',
        'nbsp': ' ',
        'amp': '&',
        'quot': '"'
    };
    return str.replace(/&(lt|gt|nbsp|amp|quot);/ig, function (all, t) {
        return arrEntities[t]
    })
}


function GetQueryString(name) {
    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
    var r = window.location.search.substr(1).match(reg); //获取url中"?"符后的字符串并正则匹配
    var context = "";
    if (r != null)
        context = decodeURIComponent(r[2]);
    reg = null;
    r = null;
    return context == null || context == "" || context == "undefined" ? "" : context;
}